﻿// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;

namespace Microsoft.Data.SqlClient.Server
{
    /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\DataAccessKind.xml' path='docs/members[@name="DataAccessKind"]/DataAccessKind/*' />
    [Serializable]
    public enum DataAccessKind
    {
        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\DataAccessKind.xml' path='docs/members[@name="DataAccessKind"]/None/*' />
        None = 0,
        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\DataAccessKind.xml' path='docs/members[@name="DataAccessKind"]/Read/*' />
        Read = 1,
    }

    /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SystemDataAccessKind.xml' path='docs/members[@name="SystemDataAccessKind"]/SystemDataAccessKind/*' />
    [Serializable]
    public enum SystemDataAccessKind
    {
        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SystemDataAccessKind.xml' path='docs/members[@name="SystemDataAccessKind"]/None/*' />
        None = 0,
        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SystemDataAccessKind.xml' path='docs/members[@name="SystemDataAccessKind"]/Read/*' />
        Read = 1,
    }

    /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SqlFunctionAttribute.xml' path='docs/members[@name="SqlFunctionAttribute"]/SqlFunctionAttribute/*' />
    // sql specific attribute
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false), Serializable]
    public class SqlFunctionAttribute : System.Attribute
    {
        private bool m_fDeterministic;
        private DataAccessKind m_eDataAccess;
        private SystemDataAccessKind m_eSystemDataAccess;
        private bool m_fPrecise;
        private string m_fName;
        private string m_fTableDefinition;
        private string m_FillRowMethodName;

        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SqlFunctionAttribute.xml' path='docs/members[@name="SqlFunctionAttribute"]/ctor/*' />
        public SqlFunctionAttribute()
        {
            // default values
            m_fDeterministic = false;
            m_eDataAccess = DataAccessKind.None;
            m_eSystemDataAccess = SystemDataAccessKind.None;
            m_fPrecise = false;
            m_fName = null;
            m_fTableDefinition = null;
            m_FillRowMethodName = null;
        } // SqlFunctionAttribute

        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SqlFunctionAttribute.xml' path='docs/members[@name="SqlFunctionAttribute"]/IsDeterministic/*' />
        public bool IsDeterministic
        {
            get
            {
                return m_fDeterministic;
            }
            set
            {
                m_fDeterministic = value;
            }
        } // Deterministic

        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SqlFunctionAttribute.xml' path='docs/members[@name="SqlFunctionAttribute"]/DataAccess/*' />
        public DataAccessKind DataAccess
        {
            get
            {
                return m_eDataAccess;
            }
            set
            {
                m_eDataAccess = value;
            }
        } // public bool DataAccessKind

        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SqlFunctionAttribute.xml' path='docs/members[@name="SqlFunctionAttribute"]/SystemDataAccess/*' />
        public SystemDataAccessKind SystemDataAccess
        {
            get
            {
                return m_eSystemDataAccess;
            }
            set
            {
                m_eSystemDataAccess = value;
            }
        } // public bool SystemDataAccessKind

        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SqlFunctionAttribute.xml' path='docs/members[@name="SqlFunctionAttribute"]/IsPrecise/*' />
        public bool IsPrecise
        {
            get
            {
                return m_fPrecise;
            }
            set
            {
                m_fPrecise = value;
            }
        } // Precise

        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SqlFunctionAttribute.xml' path='docs/members[@name="SqlFunctionAttribute"]/Name/*' />
        public string Name
        {
            get
            {
                return m_fName;
            }
            set
            {
                m_fName = value;
            }
        }

        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SqlFunctionAttribute.xml' path='docs/members[@name="SqlFunctionAttribute"]/TableDefinition/*' />
        public string TableDefinition
        {
            get
            {
                return m_fTableDefinition;
            }
            set
            {
                m_fTableDefinition = value;
            }
        }
        /// <include file='..\..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient.Server\SqlFunctionAttribute.xml' path='docs/members[@name="SqlFunctionAttribute"]/FillRowMethodName/*' />
        public string FillRowMethodName
        {
            get
            {
                return m_FillRowMethodName;
            }
            set
            {
                m_FillRowMethodName = value;
            }
        }

    } // class SqlFunctionAttribute
}
